home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_qt.idb / usr / freeware / include / Qt / qfileinfo.h.z / qfileinfo.h
Encoding:
C/C++ Source or Header  |  1998-10-28  |  2.6 KB  |  111 lines

  1. /****************************************************************************
  2. ** $Id: qfileinfo.h,v 2.4 1998/07/03 00:09:44 hanord Exp $
  3. **
  4. ** Definition of QFileInfo class
  5. **
  6. ** Created : 950628
  7. **
  8. ** Copyright (C) 1992-1998 Troll Tech AS.  All rights reserved.
  9. **
  10. ** This file is part of Qt Free Edition, version 1.40.
  11. **
  12. ** See the file LICENSE included in the distribution for the usage
  13. ** and distribution terms, or http://www.troll.no/free-license.html.
  14. **
  15. ** IMPORTANT NOTE: You may NOT copy this file or any part of it into
  16. ** your own programs or libraries.
  17. **
  18. ** Please see http://www.troll.no/pricing.html for information about 
  19. ** Qt Professional Edition, which is this same library but with a
  20. ** license which allows creation of commercial/proprietary software.
  21. **
  22. *****************************************************************************/
  23.  
  24. #ifndef QFILEINFO_H
  25. #define QFILEINFO_H
  26.  
  27. #ifndef QT_H
  28. #include "qfile.h"
  29. #include "qdatetime.h"
  30. #endif // QT_H
  31.  
  32. class QDir;
  33. struct QFileInfoCache;
  34.  
  35.  
  36. class QFileInfo                   // file information class
  37. {
  38. public:
  39.     enum PermissionSpec {
  40.     ReadUser  = 0400, WriteUser  = 0200, ExeUser  = 0100,
  41.     ReadGroup = 0040, WriteGroup = 0020, ExeGroup = 0010,
  42.     ReadOther = 0004, WriteOther = 0002, ExeOther = 0001 };
  43.  
  44.     QFileInfo();
  45.     QFileInfo( const char *file );
  46.     QFileInfo( const QFile & );
  47.     QFileInfo( const QDir &, const char *fileName );
  48.     QFileInfo( const QFileInfo & );
  49.    ~QFileInfo();
  50.  
  51.     QFileInfo  &operator=( const QFileInfo & );
  52.  
  53.     void    setFile( const char *file );
  54.     void    setFile( const QFile & );
  55.     void    setFile( const QDir &, const char *fileName );
  56.  
  57.     bool    exists()    const;
  58.     void    refresh()    const;
  59.     bool    caching()    const;
  60.     void    setCaching( bool );
  61.  
  62.     const char *filePath()    const;
  63.     QString    fileName()    const;
  64.     QString    absFilePath()    const;
  65.     QString    baseName()    const;
  66.     QString    extension()    const;
  67.  
  68.     QString    dirPath( bool absPath = FALSE ) const;
  69.     QDir    dir( bool absPath = FALSE )    const;
  70.  
  71.     bool    isReadable()    const;
  72.     bool    isWritable()    const;
  73.     bool    isExecutable()    const;
  74.  
  75.     bool    isRelative()    const;
  76.     bool    convertToAbs();
  77.  
  78.     bool    isFile()    const;
  79.     bool    isDir()        const;
  80.     bool    isSymLink()    const;
  81.  
  82.     QString    readLink()    const;
  83.  
  84.     const char *owner()        const;
  85.     uint    ownerId()    const;
  86.     const char *group()        const;
  87.     uint    groupId()    const;
  88.  
  89.     bool    permission( int permissionSpec ) const;
  90.  
  91.     uint    size()        const;
  92.  
  93.     QDateTime    lastModified()    const;
  94.     QDateTime    lastRead()    const;
  95.  
  96. private:
  97.     void    doStat() const;
  98.     QString    fn;
  99.     QFileInfoCache *fic;
  100.     bool    cache;
  101. };
  102.  
  103.  
  104. inline bool QFileInfo::caching() const
  105. {
  106.     return cache;
  107. }
  108.  
  109.  
  110. #endif // QFILEINFO_H
  111.